﻿/**
 * ZSprite
 *
 * @author		Allen Chou
 * @version		1.0.2 (last update: Jan 25 2009)
 * @link        http://cjcat.blogspot.com
 * @link		http://cjcat2266.deviantart.com
 */

package idv.cjcat.display.zcontainer {
	import flash.display.*;
	
	/**
	 * A <code>ZSprite</code> object is to be added to a <code>ZContainer's</code> display list.
	 * 
	 * <p>
	 * The <code>z</code> property has been overidden, which does not act like the default <code>z</code> property of a <code>Sprite</code>.
	 * </p>
	 * 
	 * <p>
	 * Setting the <code>z</code> property does not force the <code>ZSprite</code> to be cached as bitmap as is an ordinary <code>Sprite</code> will due to the default 3D behavior in Flash Player 10.
	 * Instead, setting the <code>z</code> property will affect the outcome of the parent <code>ZContainer's</code> rendering, according to whether the container is using perspective projection or orthogonal projection.
	 * </p>
	 */
	public class ZSprite extends Sprite {
		
		private var _x:Number = 0;
		private var _y:Number = 0;
		private var _z:Number = 0;
		
		/** @private */
		internal var _outOfRange:Boolean = false;
		/** @private */
		internal var _visibleBeforeOutOfRange:Boolean = false;
		
		public function ZSprite() {
		}
		
		/** @private */
		internal function get superX():Number { return super.x; }
		/** @private */
		internal function set superX(value:Number):void { super.x = value; }
		/** @private */
		internal function get superY():Number { return super.y; }
		/** @private */
		internal function set superY(value:Number):void { super.y = value; }
		
		public override function get x():Number { return _x; }
		public override function set x(value:Number):void { _x = value; }
		public override function get y():Number { return _y; }
		public override function set y(value:Number):void { _y = value; }
		public override function get z():Number { return _z; }
		public override function set z(value:Number):void { _z = value; }
		
	}
}